package com.topc.service.impl;


import com.topc.base.exception.Asserts;
import com.topc.service.FileService;
import com.topc.util.MinioUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

@Service
public class FileServiceImpl implements FileService {

    @Autowired
    private MinioUtils minioUtils;

    @Override
    public String uploadFile(MultipartFile file){
        return minioUtils.uploadOne(file);
    }

    @Override
    public void deleteFile(String fileName) {
        Boolean aBoolean = minioUtils.removeOne(fileName);
        if (!aBoolean) Asserts.fail("文件上传失败");
    }


}
